<template>
  <div class="main">
    <MyHeader></MyHeader>
    <MyGoods :obj="item" v-for="item in list" :key="item.id"></MyGoods>
    <MyFooter :arr="list"></MyFooter>
  </div>
</template>

<script>
// 获取-购物车列表接口  GET  https://applet-base-api-t.itheima.net/api/cart
import MyHeader from "@/components/MyHeader.vue";
import MyGoods from "@/components/MyGoods.vue";
import MyFooter from "@/components/MyFooter.vue";
import "bootstrap/dist/css/bootstrap.css";
import axios from "axios";

export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      list: [], // 商品所有数据
    };
  },
  async created() {
    const { data: res } = await axios.get(
      "https://applet-base-api-t.itheima.net/api/cart"
    );
    console.log(res);
    this.list = res.list;
  },
};
</script>

<style scoped>
.main {
  padding-top: 45px;
  padding-bottom: 50px;
}
</style>
